package com.tang.netty.nio.network;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;

/**
 * 客户端
 *
 * @author tang
 * @since 2023/7/23 20:26
 */
public class SplitClient {

    public static void main(String[] args) throws IOException {
        try (SocketChannel socketChannel = SocketChannel.open()) {
            socketChannel.connect(new InetSocketAddress("localhost", 8080));
            System.out.println("waiting......");
            socketChannel.write(StandardCharsets.UTF_8.encode("123123123123123123123123123123123132"));
            socketChannel.write(StandardCharsets.UTF_8.encode("123123123123123123123123123123123132\nworld\n"));
            System.in.read();
        }
    }

}
